# codint=utf-8
import os
import sys
import django
import time
import random

base_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(base_dir)
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "hack_server.settings")
django.setup()

from api.models import DeviceData

while 1:
    beat = random.randint(80, 120)
    device_data = DeviceData(
        device_id='123', lac='1be2',
        ci='9abc', timestamp=int(time.time()),
        beat=beat
    )
    device_data.save()
    time.sleep(3)
    print beat
